
#import "PUAboutUsVC.h"

@interface PUAboutUsVC ()
@end

@implementation PUAboutUsVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title=@"关于我们";
    self.view.backgroundColor=[UIColor colorWithRed:243/255.0 green:243/255.0 blue:243/255.0 alpha:1];
    
    UIView *view1=[[UIView alloc]init];
    view1.backgroundColor=[UIColor whiteColor];
    view1.frame=CGRectMake(0, 12*KWidthScale,self.view.bounds.size.width, 48*KWidthScale);
    view1.userInteractionEnabled=YES;
    [self.view addSubview:view1];
    
    //用户服务协议
    UITapGestureRecognizer *view1Tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(view1Gesture)];
    [view1 addGestureRecognizer:view1Tap];
    
    UIView *leftView1=[[UIView alloc]init];
    leftView1.backgroundColor=[UIColor colorWithRed:255/255.0 green:114/255.0 blue:154/255.0 alpha:1];
    leftView1.frame=CGRectMake(12*KWidthScale, 16*KWidthScale,3*KWidthScale, 16*KWidthScale);
    [view1 addSubview:leftView1];
    
    UILabel *lab1 = [[UILabel alloc] init];
    lab1.frame = CGRectMake(23*KWidthScale, 0,150, view1.frame.size.height);
    lab1.text=@"用户服务协议";
    lab1.font=[UIFont systemFontOfSize:16];
    lab1.textColor=[UIColor blackColor];
    [view1 addSubview:lab1];
    
    UIImageView *img1=[[UIImageView alloc]init];
    img1.frame = CGRectMake(self.view.bounds.size.width-36*KWidthScale,12*KWidthScale,24, 24);
    img1.image=[UIImage imageNamed:@"返回"];
    [view1 addSubview:img1];
    
    UIView *view2=[[UIView alloc]init];
    view2.backgroundColor=[UIColor whiteColor];
    view2.frame=CGRectMake(0, 12*KWidthScale+view1.frame.origin.y+view1.frame.size.height,self.view.bounds.size.width, 48*KWidthScale);
    view2.userInteractionEnabled=YES;
    [self.view addSubview:view2];
    
    //隐私权限
    UITapGestureRecognizer *view2Tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(view2Gesture)];
    [view2 addGestureRecognizer:view2Tap];
    
    
    UIView *leftView2=[[UIView alloc]init];
    leftView2.backgroundColor=[UIColor colorWithRed:255/255.0 green:114/255.0 blue:154/255.0 alpha:1];
    leftView2.frame=CGRectMake(12*KWidthScale, 16*KWidthScale,3*KWidthScale, 16*KWidthScale);
    [view2 addSubview:leftView2];
    
    UILabel *lab2 = [[UILabel alloc] init];
    lab2.frame = CGRectMake(23*KWidthScale, 0,150, view2.frame.size.height);
    lab2.text=@"隐私权限";
    lab2.font=[UIFont systemFontOfSize:16];
    lab2.textColor=[UIColor blackColor];
    [view2 addSubview:lab2];
    
    UIImageView *img2=[[UIImageView alloc]init];
    img2.frame = CGRectMake(self.view.bounds.size.width-36*KWidthScale,12*KWidthScale,24, 24);
    img2.image=[UIImage imageNamed:@"返回"];
    [view2 addSubview:img2];
    
    UILabel *nameLab = [[UILabel alloc] init];
    nameLab.frame = CGRectMake(0, 12*KWidthScale+view2.frame.origin.y+view2.frame.size.height,self.view.bounds.size.width, 21*KWidthScale);
    nameLab.text=@"";
    nameLab.font=[UIFont systemFontOfSize:12];
    nameLab.textColor=[UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
    nameLab.textAlignment=NSTextAlignmentCenter;
    [self.view addSubview:nameLab];
    
    
    UILabel *beianhaoLab = [[UILabel alloc] init];
    beianhaoLab.frame = CGRectMake(0, 12*KWidthScale+nameLab.frame.origin.y+nameLab.frame.size.height,self.view.bounds.size.width, 21*KWidthScale);
    beianhaoLab.text=@"";
    beianhaoLab.font=[UIFont systemFontOfSize:12];
    beianhaoLab.textColor=[UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
    beianhaoLab.textAlignment=NSTextAlignmentCenter;
    [self.view addSubview:beianhaoLab];
    NSDictionary *saveSystemConfig1 = [Config getSystemConfig];
    
    if (saveSystemConfig1!=nil) {
        NSString *app_icp=saveSystemConfig1[@"customer_service"][@"app_icp"];
        NSString *topStr=app_icp;
        if (app_icp!=nil&&![app_icp isEqualToString:@""]) {
            NSString *s=[NSString stringWithFormat:@"App备案号：%@",topStr];
            nameLab.text=saveSystemConfig1[@"customer_service"][@"company"];
            NSMutableAttributedString *hogan1 = [[NSMutableAttributedString alloc] initWithString:s];
            [hogan1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:NSMakeRange(0, s.length)];
            [hogan1 addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1] range:NSMakeRange(0, s.length)];
            [hogan1 addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:12] range:NSMakeRange(s.length-topStr.length, topStr.length)];
            [hogan1 addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:255/255.0 green:55/255.0 blue:115/255.0 alpha:1] range:NSMakeRange(s.length-topStr.length,topStr.length)];
            beianhaoLab.attributedText = hogan1;
        }
       
    }
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

//用户服务协议
-(void)view1Gesture{
//    systemMode* model  =  [LCSaveModel getsystemMode];
//    BaseWebViewController *baseWebViewController = [[BaseWebViewController alloc] init];
//    baseWebViewController.requestUrl = [NSString stringWithFormat:@"%@%@?p=3",model.h5_url,@"user_agreement"];
//    [self.navigationController pushViewController:baseWebViewController animated:YES];
    
      NSDictionary *saveOpen_app_config = [Config getOpenAppConfig];
      NSString *h5_url=@"";
      if (saveOpen_app_config!=nil) {
          h5_url=saveOpen_app_config[@"h5_url"];
      }
      NSString* url = [NSString stringWithFormat:@"%@%@?p=4",h5_url,@"user_agreement"];
      PUWebViewVC *vc=[[PUWebViewVC alloc]init];
      vc.is_topbar=0;
      vc.url=url;
      vc.titleStr=@"用户服务协议";
      [self.navigationController pushViewController:vc animated:YES];
}
//隐私权限
-(void)view2Gesture{
//    systemMode* model  =  [LCSaveModel getsystemMode];
//    BaseWebViewController *baseWebViewController = [[BaseWebViewController alloc] init];
//    baseWebViewController.requestUrl = [NSString stringWithFormat:@"%@%@?p=3",model.h5_url,@"privacy_policy"];
//    [self.navigationController pushViewController:baseWebViewController animated:YES];
    
    NSDictionary *saveOpen_app_config = [Config getOpenAppConfig];
    NSString *h5_url=@"";
    if (saveOpen_app_config!=nil) {
        h5_url=saveOpen_app_config[@"h5_url"];
    }
    NSString* url = [NSString stringWithFormat:@"%@%@?p=4",h5_url,@"privacy_policy"];
    PUWebViewVC *vc=[[PUWebViewVC alloc]init];
    vc.is_topbar=0;
    vc.url=url;
    vc.titleStr=@"隐私协议";
    [self.navigationController pushViewController:vc animated:YES];
}
@end
